Dashboard Temp Share Shortlinks Frames API

HTMLify

Rotate String Or Check If One String Is A Rotation Of Another String
Views: 1 | Author: cody
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
class Solution {
public:
    bool rotateString(string s, string goal) {
        int l1 = s.length();
        int l2 = goal.length();

        if(l1 != l2) return false;

        else{
            string temp = s + s;
            if(temp.find(goal) != string::npos){
                return true;
            }
            return false;
        }
    }
};